package com.uduew.sjd.view.xpop;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.uduew.sjd.R;
import com.lxj.xpopup.core.CenterPopupView;

public class RepaymentDetailsXpop extends CenterPopupView {
    TextView detailsConfirmTv;

    private String ichneumon;
    private TextView tvAmountReceived, tvInterestInterest, tvServiceFee, tvTaxesFees, tvChannelMount, tvTotalAmount, tvCreditService;
    String amountReceived;
    String interestInterest;
    String serviceFee;
    String taxesFees;
    String channelMount;
    String totalAmount;
    String creditService;

    public RepaymentDetailsXpop(@NonNull Context context, String amountReceived,
                                String interestInterest,
                                String serviceFee,
                                String taxesFees,
                                String channelMount,
                                String totalAmount,
                                String creditService) {
        super(context);
        this.amountReceived = amountReceived;
        this.interestInterest = interestInterest;
        this.serviceFee = serviceFee;
        this.taxesFees = taxesFees;
        this.channelMount = channelMount;
        this.totalAmount = totalAmount;
        this.creditService = creditService;


    }

    private OnAgreeClickListener onAgreeClickListener;

    public void setOnAgreeClickListener(OnAgreeClickListener listener) {
        this.onAgreeClickListener = listener;
    }

    public interface OnAgreeClickListener {
        void onAgreeClick();
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.xpop_repayment_details;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        tvAmountReceived = findViewById(R.id.tv_amount_received);
        tvInterestInterest = findViewById(R.id.tv_interest_interest);

        tvCreditService = findViewById(R.id.tv_credit_service);
        tvServiceFee = findViewById(R.id.tv_service_fee);
        tvTaxesFees = findViewById(R.id.tv_taxes_fees);
        tvChannelMount = findViewById(R.id.tv_channel_mount);
        tvTotalAmount = findViewById(R.id.tv_total_amount);
        detailsConfirmTv = findViewById(R.id.details_confirm_tv);

        detailsConfirmTv.setOnClickListener(v -> {
            if (onAgreeClickListener != null) {
                onAgreeClickListener.onAgreeClick();
            }
            dismiss();
        });
        tvAmountReceived.setText(this.amountReceived);
        tvInterestInterest.setText(this.interestInterest);
        tvServiceFee.setText(this.serviceFee);
        tvTaxesFees.setText(this.taxesFees);
        tvChannelMount.setText(this.channelMount);
        tvTotalAmount.setText(this.totalAmount);
        tvCreditService.setText(this.creditService);

    }


}